home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / progrmng / mlpmodul.sit / MacLogimoPlus Documentation / DEF2 Files / CoreDump.DEF < prev    next >
Encoding:
Modula Definition  |  1990-06-14  |  3.2 KB  |  68 lines  |  [TEXT/PMED]

  1. DEFINITION MODULE CoreDump; (* Franz Kronseder / ETHZ / 04.07.85 *)
  2.                             (* last modified 06.07.85 *)
  3.                             (* memory dump mechanism for the Modula2 runtime *)
  4.                             (* modula SYSTEMX on Macintosh *)
  5. FROM SYSTEM IMPORT ADDRESS;
  6. EXPORT QUALIFIED DH, DHTyp, BytesPerBlock, errorActive, dumpActive, dumpRequest,
  7.                  HALTSP, MAINPD,Dump,DumpInhibit, ErrTextType, ErrorText, InclDump, ExclDump;
  8.  
  9. CONST maxLayer = 10; maxSegment = maxLayer+1; fnlength = 63;
  10.       (* Constants for Heap dump *)
  11.       MaxMem = 1048576;                         (* 1MB *)
  12.       BytesPerBlock = 512;                      (* Dumped block size *)
  13.       DumpMapSize = MaxMem DIV BytesPerBlock;   (* Bits in dump map, 2048 *)
  14.       DumpMapEl = DumpMapSize DIV 16;           (* = size of BITSET *)
  15.  
  16.  
  17. TYPE FileAddress = ADDRESS;    (* 32 bits *)
  18.      DHTyp = RECORD                  (* dump header, layout as written on the dump core file *)
  19.                 ErrorMP    : ADDRESS;                             (* error part *)
  20.                 ErrorPC    : ADDRESS;
  21.                 ErrorPD    : ADDRESS;
  22.                 ErrorCode  : INTEGER;
  23.                 segments   : ARRAY [0..maxSegment-1] OF RECORD    (* dump part *)
  24.                                                          fwa, lwa1  : ADDRESS;
  25.                                                          fileptr    : FileAddress;
  26.                                                         END;
  27.                 CurrentLayer : CARDINAL;                          (* loader part *)
  28.                 HeapBlockStart : FileAddress;
  29.                 DumpMap    : ARRAY [0..DumpMapEl-1] OF BITSET;
  30.                 StackBase,StackTop   : ADDRESS;
  31.                 layers     : ARRAY [0..maxLayer-1] OF
  32.                               RECORD Base,Top: ADDRESS; END;  (* fwa, lwa+1 *)
  33.                 CurrentLoadFile: ARRAY [0..fnlength-1] OF CHAR;
  34.                 dumpValid  : BOOLEAN;                             (* dump part *)
  35.               END;(*DHTyp 538 Bytes *)
  36.  
  37.  
  38. VAR
  39.   errorActive : BOOLEAN;     (* semaphore indicating DH is occupied by an error *)
  40.   dumpActive  : BOOLEAN;     (* semaphore indicating Dump is active             *)
  41.   dumpRequest : BOOLEAN;     (* parameter to ErrorRoutine, requesting a dump    *)
  42.  
  43.   DH : DHTyp; (* Dump Header *)
  44.  
  45. VAR HALTSP        : ADDRESS;      (* emergency SP for final error reporting      *)
  46. VAR MAINPD        : ADDRESS;      (* for identification of the main process      *)
  47.                                   (* also emergency PD for final error reporting *)
  48.  
  49. PROCEDURE Dump; (* write a core dump to disk *)
  50.  
  51. PROCEDURE DumpInhibit(option:INTEGER):CARDINAL;
  52.  (* modify the Dump-Inhibit, or the StopInhibit counter, clear it, or inquire it *)
  53.  (* option = +1: disable, -1: enable dump. =0: clear/enable. =2 inquire value *)
  54.  
  55. PROCEDURE InclDump(p: ADDRESS; size: ADDRESS);
  56. (* include a used storage area into the dumpable memory, from p to p+size-1 *)
  57.  
  58. PROCEDURE ExclDump (p: ADDRESS; size: ADDRESS);
  59. (* exclude an unused storage area from the dumpable memory, from p to p+size-1 *)
  60.  
  61. TYPE ErrTextType = ARRAY [0..49] OF CHAR;
  62.  
  63. PROCEDURE ErrorText (err: INTEGER; VAR text: ErrTextType);
  64. (* text: ARRAY [0..49] OF CHAR *)
  65. (* get an error text corresponding to a HALTX number *)
  66.  
  67. END CoreDump.
  68.